package com.xijia.wuyouwallet.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.xijia.wuyouwallet.R;
import com.xijia.wuyouwallet.bean.ProvinceData;

import java.util.List;

/**
 * Created by Administrator on 2017/11/7 0007.
 */

public class CityAdapter extends BaseAdapter {

    private List<ProvinceData.DataBean.ListBean> list;
    private Context context;

    public CityAdapter(List<ProvinceData.DataBean.ListBean> list,Context context){
        this.list = list;
        this.context = context;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return list.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder = null;
        if (view==null){
            holder = new ViewHolder();
            view = LayoutInflater.from(context).inflate(R.layout.item_select_bank,null);
            holder.item_selectBank_tv = (TextView) view.findViewById(R.id.item_selectBank_tv);
            view.setTag(holder);
        }else {
            holder = (ViewHolder) view.getTag();
        }
        holder.item_selectBank_tv.setText(list.get(i).getCity_name());
        return view;
    }

    private class ViewHolder{
        TextView item_selectBank_tv;
    }
}
